<!--  -->
<template>
  <div>微信登录
    <div v-if="isLogin">
        这里放登录 界面
    </div>
  </div>
</template>

<script lang='ts' setup>
import { reactive,toRefs,ref,onMounted} from 'vue'
import { useRoute,useRouter } from 'vue-router'
import { useAuthSotre } from '../../sotre/authStore';
 
const store=useAuthSotre();
const route = useRoute();
const router = useRouter();
console.log(11111111,route.query.code);
const isLogin=ref(false);

const login=async ()=>{

    const res=await store.loginWechatApi(route.query.code as string);
    //如果 res有token
    if(res.token){
        //跳转
        router.push("/dashboard");
    }
    else{
        isLogin.value=true;
    }

    console.log("1111111111",res);
    
   
}
login();
</script>
<style scoped>
</style>